layui.use(['layer','element',"form"], function(){
    var element = layui.element;


    var form = layui.form;

    //监听提交
    form.on('submit(formDemo)', function(data){
        layer.msg(JSON.stringify(data.field));
        return false;
    });
});

// 点击回复

$(".layui-icon-dialogue").on('click',function () {
    var index = $(".layui-icon-dialogue").index(this)-1;
    $('.reply-show-box').hide().eq(index).fadeToggle();
})

$(".dot-list").on('click',function () {
    var index = $(".dot-list").index(this)-1;
    $('.report-box').hide().eq(index).fadeToggle();
})

$('.reply-btn').on('click',function () {
    var value = $(this).parent().find('.common-reply-box').val();

    if($('.common-reply-box').val() === ''){
        $(this).css('disabled',true)
    }else{
        $(this).css('disabled',false)
        var html = " <li class=\"rest-com-item\">\n" +
            "                                            <a href=\"javascript:;\" class=\"c-user-name\">你:</a>\n" +
            "                                            <div class=\"o-common-con o-common-con-s\">\n" +
            "                                                <p class=\"o-common-con-d\">"+value+"</p>\n" +
            "                                                <div class=\"reply-show-box\">\n" +
            "                                                    <input type=\"text\" class=\"common-reply-box\" name=\"reply\" placeholder=\"请输入回复内容\">\n" +
            "                                                    <a href=\"JavaScript:;\" class=\"reply-btn\">回复</a>\n" +
            "                                                </div>\n" +
            "                                            </div>\n" +
            "                                            <div class=\"common-fun-box\">\n" +
            "                                                <ul class=\"dot-list\">\n" +
            "                                                    <li class=\"dot\"></li>\n" +
            "                                                    <li class=\"dot\"></li>\n" +
            "                                                    <li class=\"dot\"></li>\n" +
            "                                                    <div class=\"report-box\">\n" +
            "                                                        <a href=\"javascript\" class=\"report-btn\">举报</a>\n" +
            "                                                    </div>\n" +
            "                                                </ul>\n" +
            "                                                <div class=\"praise-or-reply\">\n" +
            "                                                    <span class=\"layui-icon-praise layui-icon\"></span>\n" +
            "                                                    <span class=\"layui-icon-dialogue layui-icon\"></span>\n" +
            "                                                </div>\n" +
            "                                            </div>\n" +
            "                                        </li>"
        console.log($(this).parents().find('.common-first'))
    }
})

//编辑作业
$(".dot-list").eq(0).on("click",function () {
    $(".fun-box-tr").fadeToggle();
})

